﻿#region Copyright (c) Nicola Gallo All rights reserved.
/*
 * All rights reserved. Reproduction of trasmission of this file, or a portion thereof,
 * is forbidden without prior written permission of Nicola Gallo.
 * 
 * Author: Nicola Gallo
 * Date: 09/04/2011
 * 
 * */
#endregion
namespace PrismMVC.Dashboard
{
    //.NET References
    using System;
    using System.Windows;
    
    //PrismMVC References
    using PrismMVC.Shell;
    using PrismMVC.Shell.PresentationModels;
    using PrismMVC.Shell.Views;
    
    //Microsoft Reference
    using Microsoft.Practices.Prism.Modularity;
    using Microsoft.Practices.Prism.Regions;
    using Microsoft.Practices.Prism.UnityExtensions;
    using Microsoft.Practices.Unity;

    //WPFThemes References
    using WPF.Themes;

    //PrismMVV References
    using PrismMVC.ModuleA.Services;

    /// <summary>
    /// Defines the application bootstrapper.
    /// </summary>
    public partial class Bootstrapper : UnityBootstrapper
    {
        //Methods

        /// <summary>
        /// Configures the <see cref="Microsoft.Practices.Unity.IUnityContainer"/>.
        /// </summary>
        protected override void ConfigureContainer()
        {
            base.ConfigureContainer();

            //Register infrastructure types.
            this.Container.RegisterType<IShellProxy, ShellProxy>();
            this.Container.RegisterType<IPersonsService, PersonsService>();
        }

        /// <summary>
        /// Creates the <see cref="Microsoft.Practices.Prism.Modularity.IModuleCatalog"/> used by Prism.
        /// </summary>
        /// <returns></returns>
        protected override IModuleCatalog CreateModuleCatalog()
        {
            // Create the module catalog from a XAML file.
            return Microsoft.Practices.Prism.Modularity.ModuleCatalog.CreateFromXaml(
                        new Uri("/PrismMVC.Dashboard;component/ModuleCatalog.xaml", UriKind.Relative));
        }

        /// <summary>
        /// Creates the shell or main window of the application.
        /// </summary>
        /// <returns></returns>
        protected override DependencyObject CreateShell()
        {
            // Use the container to create an instance of the shell.
            ShellView view = Container.TryResolve<ShellView>();

            ThemeManager.SetTheme(view, "ExpressionDark");

            // Display the shell's root visual.
            view.Show();

            return view;
        }
    }
}